import java.util.Random;
import java.util.Scanner;

public class union_lotto {
    public static void main(String[] args) {
        int[] arr1 = new int[7];
        int[] arr2 = new int[7];
        computer_product(arr2);
        player_guess(arr1);
        System.out.println("玩家输入的号码:");
        print(arr1);
        System.out.println("中奖号码:");
        print(arr2);
        prise(arr1, arr2);
    }

    public static void prise(int[] arr1, int[] arr2) {
        int red_count = 0;
        int blue_count = 0;
        for (int i = 0; i < arr1.length - 1; i++) {
            for (int j = 0; j < arr2.length - 1; j++) {
                if (arr1[i] == arr2[j]) {
                    red_count++;
                    break;
                }
            }
        }
        if (arr1[arr1.length - 1] == arr2[arr2.length - 1]) {
            blue_count++;
        }
        if (red_count == 6 && blue_count == 1) {
            System.out.println("恭喜你中1000万!!!(真的会有人能中嘛QAQ)");
        } else if (red_count == 6 && blue_count == 0) {
            System.out.println("恭喜你中500万!!!(不可能,绝对不可能,你作弊,运气不可能这么好!!!QAQ)");
        } else if (red_count == 5 && blue_count == 1) {
            System.out.println("恭喜你中3000元(运气真好QAQ)");
        } else if (red_count == 5 && blue_count == 0 || red_count == 4 && blue_count == 1) {
            System.out.println("恭喜你中200元(运气不错阿)");
        } else if (red_count == 4 && blue_count == 0 || red_count == 3 && blue_count == 1) {
            System.out.println("恭喜你中10元(也就一般般)");
        } else if (red_count == 1 && blue_count == 1 || red_count == 2 && blue_count == 1 || red_count == 0 && blue_count == 1) {
            System.out.println("恭喜你中5元(怎么就中五块阿)");
        }else System.out.println("不会吧不会吧,不会有人抽不到吧!!!");
    }

    public static void computer_product(int[] arr) {
        Random se = new Random();
        for (int i = 0; i < arr.length - 1; i++) {
            while (true) {
                int number = se.nextInt(33) + 1;
                if (judge(number, arr)) {
                    arr[i] = number;
                    break;
                }
            }
        }
        int number = se.nextInt(16) + 1;
        arr[arr.length - 1] = number;
    }

    public static boolean judge(int number, int[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            if (arr[i] == number) {
                return false;
            }
            if (arr[i] == 0) {
                break;
            }
        }
        return true;
    }

    public static void print(int[] arr) {
        System.out.print("[红球: ");
        for (int i = 0; i < arr.length - 1; i++) {
            System.out.print(arr[i] + ", ");
        }
        System.out.println("蓝球: " + arr[arr.length - 1] + "]");
    }

    public static void player_guess(int[] arr) {
        Scanner player = new Scanner(System.in);
        for (int i = 0; i < arr.length - 1; i++) {
            while (true) {
                boolean flag = true;
                System.out.println("请输入第" + (i + 1) + "个红球的号数(1~33之间,并且不能重复.)");
                int number = player.nextInt();
                arr[i] = number;
                if (number > 33 || number < 1) {
                    flag = false;
                }
                for (int j = 0; j < i; j++) {
                    if (arr[j] == arr[i]) {
                        flag = false;
                        break;
                    }
                }
                if (flag) {
                    break;
                }
            }
        }
        while (true) {
            System.out.println("请输入蓝球的号数(1~16之间,并且不能重复.)");
            arr[6] = player.nextInt();
            if (arr[6] <= 16 && arr[6] >= 1) {
                break;
            }
        }
    }
}